package com.hnu.util;

import java.util.Map;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;


@SuppressWarnings("serial")

public class LoginInterceptor extends AbstractInterceptor {  
	
    public static final String LOGIN_PAGE = "nologin";  
    
    public String intercept(ActionInvocation actioninvocation) throws Exception {  
    	Map<String, Object> session = actioninvocation.getInvocationContext().getSession();
        Object obj = session.get("user");  
        if (obj == null) {
            return LOGIN_PAGE;  
        } else {  
            return actioninvocation.invoke();
        }
    }  
}  
